\section{input --- Get user response}
\label{fn:input}
\index{input()}
\index{get user response}
\index{user input}
\begin{rail}
Input : 'input' '(' String (',' '"s"' ) ? ')' ;
\end{rail}

The \verb+input+ function provides an easy method for users to get a
simple response from the keyboard. The string argument is printed
on the standard output (usually the screen), and the program waits
for the user response. \verb+input+ then returns the input, which can be
either a string, or a number. If you want to force the input to be
a string, then use the optional second argument, \verb+"s"+, to force
the return value to be a string.  Actually any argument will do --- 
just so long as there is some argument.

If the user just hits return when prompted, then \verb+input+
returns an empty matrix.

$\Longrightarrow$ This is not an \RLaB\ built-in function.  This function
is normally loaded on start-up from the \verb+input.r+ file in the
standard \verb+rlib+ directory. Use of the \verb+-r+ option, incorrectly 
setting the \verb+RLAB_LIB_DIR+ environmental variable, or modifying
\verb+input.r+ may make this function unavailable.


\paragraph{Example}
\index{example of input()}
\index{input()!example}
\begin{verbatim}
> response = input("Don't just stand there! Do something:");
Don't just stand there! Do something:text number
> response
 response =
text
> response2 = input("Don't just stand there! Do something:");
Don't just stand there! Do something:"sentance with words"
> response2
 response2 =
sentance with words
> Number = input("Gimme a number:")
Gimme a number:3.245
 Number =
     3.25
> show(Number)
   name:      Number  
   class:     num     
   type:      real    
     nr:      1       
     nc:      1       
> Number = input("Gimme a number:", "s")
Gimme a number:2.3456
 Number =
2.346
> type(Number)
string
\end{verbatim}

See also: Page~\pageref{fn:getline} \verb+getline()+.

\newpage



